﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Collections;
using System.Diagnostics;
using DVK.SP2007.Constants;

namespace DVK.SP2007
{
    public static class JobHelper
    {
        public static Logger GetLoggerForSPJob(string name, Hashtable jobProperties)
        {
            SourceLevels loggingLevel = SourceLevels.Error; //Default
            var jobsLogSourceLevel = jobProperties[Settings.JobsLogSourceLevel] as string;
            if (!string.IsNullOrEmpty(jobsLogSourceLevel))
            {
                if (Enum.GetNames(typeof(SourceLevels)).Contains(jobsLogSourceLevel))
                    loggingLevel = (SourceLevels)Enum.Parse(typeof(SourceLevels), jobsLogSourceLevel);
            }
            return new Logger(name, loggingLevel);
        }
    }
}
